﻿/**
 * Proyecto: Cognitum
 * Global IT Services 2008
 * @author
 */
Cognitum.Polizas.Gmm.Pool.Editor = Ext.extend(Cognitum.Polizas.General.Editor, {

    initComponent: function(){
        Ext.apply(this, {
            esFlotilla: true,
            seccionesAdicionales: [{
                title: 'Condiciones de la Poliza',
                items: [{
                    fieldLabel: 'Esquema Prima Minima',
                    name: 'EsquemaPrimaMinima'
                }, {
                    fieldLabel: 'Deducible %',
                    name: 'DeduciblePct',
                    xtype: 'numberfield',
				    vtype: 'numericMask'
                }, {
                    fieldLabel: 'Coaseguro %',
                    name: 'CoaseguroPct',
                    xtype: 'numberfield',
				    vtype: 'numericMask'
                }, {
                    fieldLabel: 'Suma Asegurada',
                    name: 'SumaAsegurada',
                    xtype: 'numberfield',
				    vtype: 'numericMask'
                }, {
                    fieldLabel: 'Suma Asegurada SMGM',
                    name: 'SumaAseguradaSMGM',
                    xtype: 'numberfield',
				    vtype: 'numericMask'
                }]
            }, {
                title: 'Grupos',
                items: [{
                    hideLabel: true,
                    name: 'GruposAsegurados',
                    entityName: 'GrupoAsegurados',
                    xtype: 'ag.list',
                    context: 'g.Poliza.Id=?',
                    anchor: '99% 99%',
                    updateControls: function(value){
                        if (Ext.isEmpty(value)) {
                            return;
                        }
                        // menu config
                        this.canUpdate = this.canUpdate && (value.EstatusPoliza == 0 || value.EstatusPoliza == 1);
                        this.deleteMenuAction.setDisabled(!(this.canDelete && value.EstatusPoliza == 0));
                        this.newMenuAction.setDisabled(!(this.canNew && (value.EstatusPoliza == 0 || value.EstatusPoliza == 1)));
                        this.newToolbarButton.setDisabled(!(this.canNew && (value.EstatusPoliza == 0 || value.EstatusPoliza == 1)));
                    }
                }]
            }]
        });
        
        Cognitum.Polizas.Gmm.Pool.Editor.superclass.initComponent.apply(this, arguments);
    }
    
});

Ext.reg('pol.gmm.pool.editor', Cognitum.Polizas.Gmm.Pool.Editor);
